#include "plugin_init.h"

using namespace std;
using namespace nmsp;
using namespace httplib;

// typedef std::function<void(Cont*, const httplib::Request &, httplib::Response &)> PluginCallback;
static void jd_plugin(Contp contp, const httplib::Request &req, httplib::Response &resp)
{
    MYLOG("jd====================jd=====================\n");
    resp.set_redirect("/hi");
}

extern "C"
{
    void PluginInit(int sessionId, void *session);
}

void PluginInit(int sessionId, void *session)
{
    MYLOG("=================== jd_plugin ===================");
    Cont *contp = ContCreate(std::bind(jd_plugin, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), "/jd", nullptr);
    HttpHookAdd(HTTP_READ_REQUEST_HDR_HOOK, contp);
}
